package com.github.bean;

import lombok.Data;
import org.springframework.web.socket.WebSocketSession;

@Data
public class ServerUserSession {
    private String account;
    private String deviceID;
    private String deviceType;
    private String token;
    private WebSocketSession session;
    private long lastRequestStartCallToCard;
    private int timeout = 10;
    private long lastHeartbeatTime;
    private int offlineNum = 0;

    public void setLastHeartbeatTime(long lastCHeartbeatTime) {
        if (lastCHeartbeatTime > 0)
            offlineNum = 0;
        this.lastHeartbeatTime = lastCHeartbeatTime;
    }
    public boolean isOnline() {
        return session != null && session.isOpen();
    }


}
